<%@page import="DAL.*" errorPage="_Error.jsp"%>
<%@page import="java.util.*,java.text.SimpleDateFormat;"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" type="text/css" href="../Style/EditStyle.css"/>
<script type="text/javascript" src="/SPORT/Script/jquery-1.10.1.js"></script>
<script type="text/javascript">
	$(function()
	{		
		//取消按钮点击事件
		$("#btnCancel").click(function()
		{
			location.href="/SPORT/MathHandle?type=4";//点击后跳转至MathHandle Servlet页面
		});
	});
</script>

</head>
<body>
	<%
		response.setCharacterEncoding("UTF-8");//设置输出编码格式
		String MathId=request.getParameter("MathId").toString();//获取url传过来的MathId
	        DAL.Math math=new DAL.Math();//实例化Math对象
	        List<Object> mathList=math.getEntityById(MathId);//根据ID获取Math数据
	        Object[] obj=(Object[])mathList.get(0);//将List数据转换成Object[]
	        
	 %>
	 <form action="/SPORT/MathHandle?type=2" method="post">
		<table style=" margin:50px auto;">
	            <tbody>
			 <tr><td>项目编号：</td><td><input type="text" name="MathId" value="<%=obj[0] %>"  readonly="readonly" /></td></tr>
			 <tr><td>项目名称：</td><td><input type="text" name="MathName" value="<%=obj[1] %>"  required /></td></tr>
			 <tr><td>比赛时间：</td><td>
			 	<%
			 			SimpleDateFormat dateFormat =new    SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 
	               				String time=dateFormat.format(obj[2]);
			 	 %>
			 	<input type="text" name="MathStartime" value="<%=time %>" required />
			 </td></tr>
			 <tr><td>比赛地点：</td><td><input type="text" name="MathLocation" value="<%=obj[3] %>"  required /></td></tr>
			 <tr><td>裁判名称：</td><td>
			 	<select name="JudgeId">    
			 	<%
                			Judge judge=new Judge();
					List<Object> list=judge.getEntity();
                			Object[] objList;
                			for(int i=0;i<list.size();i++)
                			{
                				objList=(Object[])list.get(i);
                				if(obj[4].equals(objList[0])){
                					out.write("<option value='"+objList[0]+"' selected='selected'>"+objList[1]+"</option>");
                				}
                				else{
                					out.write("<option value='"+objList[0]+"'>"+objList[1]+"</option>");
                				}
                				
                			}
                		 %>
                		 </select>
			 </td></tr>
			 <tr><td>是否结束：</td><td>
			 	<select name="MathIsDel">
	                		<%
	                			if(obj[5].toString().equals("0")){
	                				out.write("<option value='0' selected='selected'>未进行</option>");
	                				out.write("<option value='1'>进行中</option>");
	                				out.write("<option value='2'>已结束</option>");
	                			}
	                			else{
	                				if(obj[5].toString().equals("1"))
	                				{
	                					out.write("<option value='0'>未进行</option>");
		                				out.write("<option value='1' selected='selected'>进行中</option>");
		                				out.write("<option value='2'>已结束</option>");
	                				}
	                				else
	                				{
	                					out.write("<option value='0'>未进行</option>");
		                				out.write("<option value='1'>进行中</option>");
		                				out.write("<option value='2' selected='selected'>已结束</option>");
	                				}
	                			}
	                		 %>
	                	</select>
			 </td></tr>
			 <tr><td>附加信息：</td><td>
			 	<select name="MathTag">
				      <%
				       if(obj[6].toString().equals("0"))
				       {
				      %>
					       <option value="0" selected="selected">按时间排名</option>
					       <option value="1">按距离排名</option>
				      <%
				       }
				       else
				       {
				       %>
					        <option value="0">按时间排名</option>
					     	<option value="1" selected="selected">按距离排名</option>
				      <% } %>
				 </select>
			 </td></tr>

		    </tbody>   
	            
	            <tfoot>
	                <tr><td><input type="submit" value="确定" id="btnSure"/></td><td><input type="button" value="取消" id="btnCancel"/></td></tr>
	            </tfoot> 
	        </table>
     </form>
</body>
</html>
